<template>
    <div>
        <div class="orders-box">
            <div>
                <div style="display: flex;align-items: center;justify-content: space-between;padding-bottom: 15px;">
                    <div class="skuid">订单号:{{goodsInfo.ordernumber}}</div>
                    <div style="width: 50px;text-align: center;margin-right: 15px">{{goodsInfo.status ==0 ? '待支付': '已支付'}}</div>
                </div>
                <div style="width: 345px;border-bottom: 1px solid #eaeaea;margin-bottom: 15px"></div>
            </div>
            <div class="order-info">
                <div class="">商品名称:{{goodsInfo.title}}</div>
                <div style="display: flex;align-items: center;margin-top: 5px">消费金额:<span
                        class="price">￥{{goodsInfo.price}}</span></div>
                <div style="width: 100%;margin-top: 15px;display: flex;align-items: center;justify-content: flex-end;">
                    <div style="padding-right: 15px">下单时间:{{goodsInfo.createtime | settime}}</div>
                </div>
            </div>
        </div>
    </div>
</template>

<script>
    import {format} from '../../assets/js/untils';
    export default {
        name: "orderDetails",
        data(){
            return{
                uri: '',
                id: null,
                isPay:false,
                goodsInfo:{}
            }
        },
        created(){
            this.id = this.$route.params.id;
            this.uri = this.Url;
            this.getDetails(this.$route.params.id);
        },
        filters: {
            settime(val) {
                return format(val, true)
            }
        },
        methods:{
            getDetails(id){
                let that = this;
                that.request1.post1({
                    url: that.Url + "api/goods/orderdetail",
                    params: {orderid: id},
                    success: function (res) {
                        if (res.data.code == 1) {
                            that.goodsInfo = res.data.data.order;
                        } else {
                            alert(res.data.msg)
                        }
                    },
                    fail: function (error) {
                        alert(error.data.msg)
                    }
                });
            },
        }
    }
</script>

<style scoped>
    .orders-box {
        overflow: hidden;
        background-color: #ffffff;
        padding: 10px 0 10px 15px;
        border-radius: 10px;
        color: #333;
        font-size: 13px;
    }

    .skuid {
        width: 100%;
        color: #000;
        font-size: 14px;
    }
</style>